using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UControlsBase_CascadingDropList : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (dllListItemsWidth != null)
        {
            selectCommand.Style["Width"] = dllListItemsWidth.Value.ToString()  + "px"; 
        }
        //if (this.ClearDLLItems == true)
        //{
        //    dllListItems.Items.Clear();
        //}
        if (!UseContextKeyCascade)
        {
            CascadingDropDownList.SelectedValue = "";
            CascadingDropDownList.ContextKey = "";
        }
       
    }
    #region OverrideControlMethods
    protected override void OnInit(EventArgs e)
    {
        Page.RegisterRequiresControlState(this);
        base.OnInit(e);
    }

    protected override void LoadControlState(object savedState)
    {
        base.LoadControlState(savedState);
    }
    protected override object SaveControlState()
    {
        return base.SaveControlState();
    }
    #endregion

    #region AllProperites
    private bool _clearDLLItems;

    public bool ClearDLLItems
    {
        get { return _clearDLLItems; }
        set { _clearDLLItems = value; }
    }
	
    public Unit dllListItemsWidth
    {
        get 
        {
            if (dllListItems.Width == null)
            {
                dllListItems.Width = 200;
            }
            return dllListItems.Width; 
        }
        set { dllListItems.Width = value; }
    }
    public string ClientIDCascade
    {
        get { return dllListItems.ClientID; }
         //+ "_dllListItems"
    }
    public string ClientIDAjaxCascade
    {
        get { return CascadingDropDownList.ClientID; }
        //+ "_dllListItems"
    }

    public string PromptTextCascade
    {
        get { return CascadingDropDownList.PromptText; }
        set { CascadingDropDownList.PromptText = value; }
    }

    public string ServicePathCascade
    {
        get { return CascadingDropDownList.ServicePath; }
        set { CascadingDropDownList.ServicePath = value; }
    }

    public string CategoryCascade
    {
        get { return CascadingDropDownList.Category; }
        set { CascadingDropDownList.Category = value; }
    }
    public string ServiceMethodCascade
    {
        get { return CascadingDropDownList.ServiceMethod; }
        set { CascadingDropDownList.ServiceMethod = value; }
    }

  
    public string ParentControlIDCascade
    {
        get { return CascadingDropDownList.ParentControlID + "$" + this.dllListItems.ID; }
        set { CascadingDropDownList.ParentControlID = value +"$" + this.dllListItems.ID; }
    }
	
    public string dllListItemsValue
    {
        get { return dllListItems.SelectedItem.Value; }
        set { dllListItems.SelectedItem.Value = value; }
    }

    public string dllListItemsText
    {
        get { return dllListItems.SelectedItem.Text; }
        set { dllListItems.SelectedItem.Text = value; }
    }
    public string SelectedValueCascade
    {
        get { return CascadingDropDownList.SelectedValue; }
        set { CascadingDropDownList.SelectedValue = value; }
    }
    public string EmptyTextCascade
    {
        get { return CascadingDropDownList.EmptyText; }
        set { CascadingDropDownList.EmptyText = value; }
    }
    public string EmptyValueCascade
    {
        get { return CascadingDropDownList.EmptyValue; }
        set { CascadingDropDownList.EmptyValue = value; }
    }
    public string ContextKeyCascade
    {
        get { return CascadingDropDownList.ContextKey; }
        set { CascadingDropDownList.ContextKey = value; }
    }
    public bool UseContextKeyCascade
    {
        get { return CascadingDropDownList.UseContextKey; }
        set { CascadingDropDownList.UseContextKey = value; }
    }
    public int dllListItemsIndex
    {
        get { return dllListItems.SelectedIndex; }
        set { dllListItems.SelectedIndex = value; }
    }
    

    public bool dllListAutoPostBack
    {
        get { return dllListItems.AutoPostBack; }
        set { dllListItems.AutoPostBack = value; }
    }
	
    public bool EnableRequiredFiled
    {
        get
        {
            return RequiredField.Enabled;
        }
        set
        {
            RequiredField.Enabled = value;
        }
    }
    

    public bool SetFocusOnErrorRequiredField
    {
        get { return RequiredField.SetFocusOnError; }
        set { RequiredField.SetFocusOnError = value; }
    }
	

    public string RequiredFiledMessageErr
    {
        get
        {
            return RequiredField.ErrorMessage;
        }
        set
        {
            RequiredField.ErrorMessage = value;
        }
    }
    public string InitialValueText
    {
        get
        {
            return RequiredField.InitialValue;
        }
        set
        {
            RequiredField.InitialValue = value;
        }
    }
    public string ValidationGroupText
    {
        get
        {
            return RequiredField.ValidationGroup;
        }
        set
        {
            RequiredField.ValidationGroup = value;
        }
    }


    #endregion
}
